package com.datang.petstore.controller;

import com.datang.petstore.aop.ForbidAnnotation;
import com.datang.petstore.entity.MicroblogInformRecord;
import com.datang.petstore.model.MicroblogInformRecordRequest;
import com.datang.petstore.resultpage.Result;
import com.datang.petstore.service.MicroblogInformRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-11-03 15:25
 * @notify 举报API
 * @version 1.0
 */
@RestController
public class MicroblogInformRecordController {

    @Autowired
    private MicroblogInformRecordService microblogInformRecordService;


    /*
     * @author 顶风少年
     * @date 2019/11/3 15:02
     * @mail dfsn199703132038@foxmail.com
     * @throws
     * @param
     * @param userId
     * @param microblogId
     * @result void
     * @notify 添加举报记录
     * version 1.0
     */
    @PostMapping(value = "microblog/inform")
    @ForbidAnnotation
    public Result addMicroblogInformRecord(@RequestBody MicroblogInformRecordRequest microblogInformRecordRequest) {
        MicroblogInformRecord microblogInformRecord = new MicroblogInformRecord();
        BeanUtils.copyProperties(microblogInformRecordRequest, microblogInformRecord);
        microblogInformRecordService.addMicroblogInformRecord(microblogInformRecord);
        return Result.ok();
    }
}
